package com.zyh.demo;

public class OOPDemo3 {
    public static void main(String[] args) {
        Zi zi = new Zi();
//        编译看左边，运行看右边
        zi.method();
        zi.ziMethod();
        zi.fuMethod();
//        静态编译和运行都看左边
        zi.ziStaticMethod();
        System.out.println("---------------");

        Fu fu = new Fu();
        fu.method();
//        fu.ziMethod();
        fu.fuMethod();
        fu.fuStaticMethod();
        System.out.println("---------------");

        Fu fu1=new Zi();
        fu1.method();
        fu1.fuMethod();
//        fu1.ziMethod();
        fu1.fuStaticMethod();
//        fu1.ziStaticMethod();
    }
}
class Fu{
    public int num=10;
    public int fuNum=100;
    public void method(){
        System.out.println("这是父类的method方法");
    }
    public void fuMethod(){
        System.out.println("这是父类的fuMethod方法");
    }
    public static void fuStaticMethod(){
        System.out.println("这是父类的fuStaticMethod方法");
    }
}
class Zi extends Fu{
    public int num=20;
    public int ziNum=200;
    public void method(){
        System.out.println("这是子类的method方法");
    }
    public void ziMethod(){
        System.out.println("这是子类的ziMethod方法");
    }
    public static void ziStaticMethod(){
        System.out.println("这是子类的ziStaticMethod方法");
    }
}
